package com.wgts.wgts.mvp.presenter.imp;

import com.wgts.wgts.mvp.model.IAddAddressActivityModel;
import com.wgts.wgts.mvp.presenter.IAddAddressActivityPresenter;
import com.wgts.wgts.mvp.view.IAddAddressActivityView;
import com.wgts.wgts.netmodle.HttpResultSubscriber;
import com.wgts.wgts.netmodle.req.EditAddressRequest;
import com.wgts.wgts.netmodle.resp.CurrentEntity;

/*
 *   data:2018/10/410:42
 *
 */public class AddAddressActivityPresenter implements IAddAddressActivityPresenter {
     private IAddAddressActivityView view;
     private IAddAddressActivityModel model;

    public AddAddressActivityPresenter(IAddAddressActivityView view, IAddAddressActivityModel model) {
        this.view = view;
        this.model = model;
    }

    @Override
    public void addAddressResult(String addressId, String userName, String userPhone, String province, String city, String area, String details, String addressState) {
        EditAddressRequest request = new EditAddressRequest();
        request.addressId = addressId;
        request.userName = userName;
        request.userPhone = userPhone;
        request.province = province;
        request.city = city;
        request.area = area;
        request.details = details;
        request.addressState = addressState;
        model.addAddressResult(request, new HttpResultSubscriber<CurrentEntity>() {
            @Override
            public void onSuccess(CurrentEntity currentEntity) {
                view.addAddressResult();
            }

            @Override
            public void _onError(int status, String msg) {
                view.onError(status, msg);
            }
        });
    }
}
